<?php
// +----------------------------------------------------------------------
// | 迁于首页
// +----------------------------------------------------------------------
// | Author: cart <469714167@qq.com>
// +----------------------------------------------------------------------
// | Datetime: 2018-5-16 14:59:00
// +----------------------------------------------------------------------
// | Copyright: 创讯科技
// +----------------------------------------------------------------------
namespace app\ice\controller;
use \think\Controller;
use think\Loader;
use app\ice\model\Area;
class Score extends Init
{
    // private $IndexModel;
    /**
     * [_initialize 初始化]
     * @return [type] [description]
     * @author carl
     * @version 2018-02-05
     * @copyright wei liang
     */
    protected function _initialize()
    {
        parent::_initialize();
        $this->UserModel = Loader::model('User');
        $this->IndexModel = Loader::model('Index');
        $this->ScoreLogModel = Loader::model('ScoreLog');
    }

    public function index(){
        $param = input('post.');

        $page = $param['page'] ? $param['page'] : 1;
        $orll_page = config('paginate.list_rows'); 
        $res = $this->IndexModel->getList($param,$page,$orll_page);
        if($res){
          return ['data' => $res, 'code' => 200, 'message' => '列表显示成功', 'status' => true ];
        }else{
          return ['data' => [], 'code' => 400, 'message' => '已经到底了哦', 'status' => true ];
        }
    }

    public function lists(){
        $param = input('post.');

        $page = $param['page'] ? $param['page'] : 1;
        $orll_page = config('paginate.list_rows'); 
        $res = $this->ScoreLogModel->getList($param,$page,$orll_page);
        if($res){
          return ['data' => $res, 'code' => 200, 'message' => '列表显示成功', 'status' => true ];
        }else{
          return ['data' => [], 'code' => 400, 'message' => '已经到底了哦', 'status' => true ];
        }
    }

    public function detail(){
      $param = input('post.');
      // $Model = new Index();
      $page = $param['page'] ? $param['page'] : 1;
      $orll_page = config('paginate.list_rows'); 
      $res = $this->IndexModel->getList($param,$page,$orll_page);
      if($res){
        return ['data' => $res, 'code' => 200, 'message' => '列表显示成功', 'status' => true ];
      }else{
        return ['data' => [], 'code' => 400, 'message' => '已经到底了哦', 'status' => true ];
      }
    }

    protected function setCache($cachename,$value,$expired){
        //TODO: set cache implementation
        return Cache::set($cachename,$value,$expired);
    }

}